<?php

namespace App\Api\Controllers;

use App\Models\Crousesheet;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use DB;
use Encore\Admin\Facades\Admin;

class GetSquadCrousesController extends Controller
{
    public function get_squad_crouses(Request $request)
    {
        $squad_id = $request->get('q');
        return DB::table('squad_crouses as sc')->leftjoin('crouses as c',function($join){
            $join->on('sc.crouse_id','=','c.id');
        })->where('sc.squad_id',$squad_id)->get(['c.id', DB::raw('c.name as text')]);
    }
}
